package com.logistics.modules.sys.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.logistics.modules.sys.entity.DatadictionaryclassificationEntity;
import com.logistics.modules.sys.service.DatadictionaryclassificationService;
import com.logistics.common.utils.PageUtils;
import com.logistics.common.utils.R;


/**
 * datadictionaryclassification控制器
 *
 * @author HURRICANE
 * @email HURRICANE@nb.com
 * @date 2022-05-11 15:29:16
 */
@RestController
@RequestMapping("sys/datadictionaryclassification")
public class DatadictionaryclassificationController {
    @Autowired
    private DatadictionaryclassificationService datadictionaryclassificationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:datadictionaryclassification:list")
    public R list(@RequestParam Map<String, Object> params){

        PageUtils page = datadictionaryclassificationService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/allList")
    public R allList(){

        List<DatadictionaryclassificationEntity> classificationIds
                = datadictionaryclassificationService.allList();

        return R.ok().put("classificationIds", classificationIds);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sys:datadictionaryclassification:info")
    public R info(@PathVariable("id") Integer id){

		DatadictionaryclassificationEntity datadictionaryclassification = datadictionaryclassificationService.getById(id);

        return R.ok().put("datadictionaryclassification", datadictionaryclassification);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("sys:datadictionaryclassification:save")
    public R save(@RequestBody DatadictionaryclassificationEntity datadictionaryclassification){

		datadictionaryclassificationService.save(datadictionaryclassification);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("sys:datadictionaryclassification:update")
    public R update(@RequestBody DatadictionaryclassificationEntity datadictionaryclassification){

		datadictionaryclassificationService.updateById(datadictionaryclassification);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sys:datadictionaryclassification:delete")
    public R delete(@RequestBody Integer[] ids){

		datadictionaryclassificationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
